<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>骑驴网-${company.cname}</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="icon" href="favicon.ico" type="image/x-icon"/>
	<link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
	<link rel="stylesheet" type="text/css" href="css/comm.css">
	<style type="text/css">
	body {
		color: #555;
	}
	img {
		margin: 0px;
		vertical-align: top;
	}
	#Content {
		line-height: 25px;
		font-size: 14px;
		padding-top: 20px;
	}
	.ContentDiv {
		width: 665px;
		text-align: left;
		padding: 0px 10px 0px 0px;
		font-size: 14px;
		float:left;
		border-right:2px solid #4273B3;
		font-size: 12px;
		line-height: 20px;
	}
	.rightDiv {
		width: 290px;
		height: auto;
		float: right;
		text-align:left;
		margin: 0px;
		padding: 0px;
	}
	.title {
		font-weight:bold;
		color:#777;
		font-size:13px;
		border-bottom: 1px dotted #DDD;
		padding: 15px 3px 3px 0px;
		margin-bottom: 6px;
	}
	ul, li{
		list-style: none;
		margin: 0px 0px 15px 0px;
		padding: 0px;
	}
	#demind {
		font-size: 12px;
	}
	</style>
	<script type="text/javascript" src="js/javer.js"></script>
  </head>
  
  <body>
  	<%@ include file="../header.jsp" %>
    <center>
    <div style="width:980px;text-align:left;margin:10px;border-bottom:2px solid #4273B3;">
    	<img alt="骑驴网" src="images/7lv_trans.png">
    </div>
    <div style="width:980px;">
    <div class="rightDiv">
    	<div style="overflow:auto;">
    		<script src="http://www.gmodules.com/ig/ifr?url=http://www.google.com/ig/modules/chinagadgets/ifestival/ifestival.xml&amp;up_item_num=5&amp;up_user_holidays=%5B%5D&amp;synd=open&amp;w=280&amp;h=200&amp;title=&amp;lang=zh-CN&amp;country=ALL&amp;border=%23ffffff%7C3px%2C1px+solid+%23999999&amp;output=js"></script>
    	</div>
    	<div class="title" style="width:45%;">最新发布的公司</div>
    	<div id="newCompany"><img src="images/icon/loading.gif">正在加载数据...</div>    	
    	<div class="title"  style="width:25%;">广告推广</div>
    	<div><p>广告推广</p></div>
    	<%@ include file="/pages/share/qq.jsp" %>
    </div>
    <div class="ContentDiv" style="height:auto;">
    	<span style="padding-left:20px;font-size:24px;font-weight:bold;">${company.cname}</span>
    	<div class="dotLine" style="width:90%;"></div>
	    <div class="companyComent"  style="border:1px;">
		    <div style="width:98%;padding-bottom:0px;">
			    <h4>公司简介</h4>
			    <div style="line-height:20px;"><p>${company.cdesc}</p></div>
			</div>
		    <div style="width:350px;float:left;margin-top:10px;padding:0px;">
		    	<h4 style="margin-top:0px;">公司规模</h4>
		    	<p>${cscale[company.cscale]}</p>
		    	<h4>公司业务</h4>
		    	<p>${cbusiness[company.cbusiness]}</p>
		    	<h4>公司地址</h4>
		    	<p>${company.caddress}
		    		<a target="_blank" href="http://my.51ditu.com/my/single/final/webmap.html?lng=11877354&lat=3207763&zoom=0&txt=${company.caddress}">
		    		<img src="images/icon/zoom.png" border="0" style="height:20px;" title="查看地图">
		    		</a>
		    	</p>
		    </div>
		    <div style="border:1px dotted #DDD;width:160px;background-color:#FDFBDB;float:right;margin:20px 40px 5px 5px;padding:10px 5px;">
		    	<center><span id="scoreSpan" class="scoreSpan">${company.cscore}</span>
		    	<span class="scoreSpan" style="font-size:20px;">分</span>
		    	<br/><span style="font-size:12px;color:#DDD;">（基础分为100分）</span>
		    	<div style="font-size:20px;color:blue;padding:5px;font-weight:bold;margin-top:4px;">
		    		<span id="ding" class="dingSpan" onclick="doDing(1)"><img src=images/icon/up.gif title="我顶">顶</span>
		    		<span id="cai" style="color:red;" class="dingSpan" onclick="doDing(-1)"><img src=images/icon/down.gif title="我踩">踩</span>
		    	</div>
		    	</center>
		    </div>
	    </div>
	    <div style="padding:10px;clear:both;height:40px;">
	    <%@ include file="../share/jiathis.jsp" %>
	    </div>
	     <%-- ############################  公司评论 --%>
	     <c:forEach items="${comments}" var="comment" varStatus="vs">
	     	<div class="companyComent" style=${vs.count%2==0?'background-image:url("images/grey.gif")':''};>
		     	<div class="usertitle">
		     		<span style="float:right;" id="agreeWrapper_${comment.id}">
		     		<script type="text/javascript">
		     			var spanContent1 = '<a href="javascript:agree(${comment.id},${comment.agree},${comment.disagree});">支持(${comment.agree})</a>&nbsp;&nbsp;<a href="javascript:disagree(${comment.id},${comment.agree},${comment.disagree});">反对(${comment.disagree})</a>';
		     			var spanContent2 = '支持(${comment.agree})&nbsp;&nbsp;反对(${comment.disagree})';
		     			if ($.Cookies.get("agreeWrapper_${comment.id}") == 1) {
		     				document.write(spanContent2);
		     			}
		     			else {
		     				document.write(spanContent1);
		     			}
		     		</script>
		     		</span>
			     	<span class="pl_num">${comment.orderNo}</span>楼  来自${comment.uaddress} ${fn:substring(comment.ctime,0,19)} 评论
		     	</div>
		     	<div style="line-height:20px;padding:10px 0px;font-size:13px;">${comment.content}</div>
		     </div>
	     </c:forEach>
	     <c:if test="${fn:length(comments) >= 5}">
		     <div style="width:90%;text-align:right;">
		     	<a href="comment.html?method=goCommentDetailPage&pageSize=10&tid=${company.id}&ctype=0" target="_blank" style="font-size:13px;color:#0082CA;text-decoration:underline;">&gt;&gt;所有评论</a>
		     </div>
	     </c:if>
	     <div class="companyComent" style="border:0px;">
		     <h5>快速评论</h5><a name="quickComment"></a>
		     <form action="company.html?method=addCompanyComment" method="post">
		     	<div style="border:0px solid blue">
		     		<img onmousemove="this.style.backgroundColor='blue'" onmouseout="this.style.backgroundColor='#FFF'" src="images/faces/0.gif" border="0" style="margin:0px;" id="show" onclick="showFace('show','disp');">
		     	</div>
		     	<textarea id="disp" name="content" style="background:url('images/qilv_comment.png') no-repeat; background-position:right bottom;" rows="5" cols="70" alt="notNull">${param.content}</textarea>
		     	<input type="hidden" name="tid" value="${param.id}">
		     	<input type="hidden" name="ctype" value="0">
		     	<input type="hidden" name="uip" value="${pageContext.request.remoteAddr}">
		     	<p>IP：${pageContext.request.remoteAddr}
		     	评分：
		     	<select name="score">
		     		<option value="0">不评分</option>
		     		<option value="-1">&nbsp;-1&nbsp;分</option>
		     		<option value="-3">&nbsp;-3&nbsp;分</option>
		     		<option value="-5">&nbsp;-5&nbsp;分</option>
		     		<option value="1">+1&nbsp;分</option>
		     		<option value="3">+3&nbsp;分</option>
		     		<option value="5">+5&nbsp;分</option>
		     	</select>
		     	</p>
		     	验证码：<input type="text" alt="notNull" name="authCode" style="width:100px;" onblur="notNull(this);">
		     	<img id="auth" style="margin-left:20px;" src="pages/share/authcode.jsp?ts=<%=new Date().getTime()%>">
		     	<label style="font-size:12px;">看不清楚，<a href="javascript:;" onclick="document.getElementById('auth').src='pages/share/authcode.jsp?ts='+new Date().getTime();">换一个</a></label>
		     	<p><input type="submit" value="提交评论">（请勿发布和主题无关的小广告，否则会无条件被删除）</p>
		     </form>
	     </div>
	     <div></div>
    </div></div></center>
    <%@ include file="../tailer.jsp" %>
  </body>
  <script type="text/javascript" src="js/validate.js"></script>
  <script type="text/javascript" src="js/comm.js"></script>
  <script type="text/javascript">
    $("newCompany").load("company.html?method=getNewCompany&limit=1");
    
	// 显示错误信息
  	if ('${error}' != '') {
  		location.hash = "#quickComment";
   		alert('${error}');
   	}
	
	function agree(id, num1, num2) {
		doAgree(id, (num1+1), num2);
		$.get("<%=basePath%>comment.html?method=modifyCommentForAgree&agree=1&disagree=0&id="+id);
	}
	
	function disagree(id, num1, num2) {
		doAgree(id, num1, (num2+1));
		$.get("<%=basePath%>comment.html?method=modifyCommentForAgree&agree=0&disagree=1&id="+id);
	}
	
	function doAgree(id, num1, num2) {
		$("agreeWrapper_" + id).html("支持("+ (num1) +")&nbsp;&nbsp;反对("+ num2 +")");
		$.Cookies.set("agreeWrapper_" + id, "1");
	}
	
  	if ($.Cookies.get("company_${company.id}")) {
  		doDing(0);
  	}
  	function doDing(num) {
  		$("ding").css("cursor", "auto").css("color", "#BBB").get().onclick = null;
  		$("cai").css("cursor", "auto").css("color", "#BBB").get().onclick = null;
  		$("scoreSpan").html(eval($("scoreSpan").html() + "+(" + num + ")"));
  		if (num != 0) {
  			$.get("company.html?method=updateCompanyScore&id=${company.id}&cscore=" + num);
  			$.Cookies.set("company_${company.id}", "1");
  		}
  	}
  	// 将浏览过的公司存入本地
 	var companyHistory = $.Cookies.get("companyHistory") || "";
  	
  	var his = companyHistory.split(","),
	  	target = [], compaCookie = "${company.id}-${company.cname}";
  	
  	if (companyHistory.length > 0) {
	  	for (var i = 0; i < his.length; i++) {
	  		if (his[i] != compaCookie) {
	  			target.push(his[i]);
	  		}
	  	}
	}
  	target.push(compaCookie);
  	
  	if (target.length > 10) {
  		target.splice(0, target.length - 10);
  	}
  	
  	companyHistory = target.join(",");
  	$.Cookies.set("companyHistory", companyHistory);
  </script>
  <script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
</html>
